<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="js/vue.js"></script>
    <script src="js/vue-router.js"></script>
</head>
<body>
<div id="app">
    <router-link to="/account">Account</router-link>
    <router-view></router-view>
</div>
<template id="tmp1">
    <div>
        <h1>这是Account组件</h1>
        <router-link to="/account/login">登录</router-link>
        <router-link to="/account/register">注册</router-link>
        <router-view></router-view>
    </div>
</template>
<script>
    const account = {
        template: '#tmp1'
    };
    const login = {
        template: '<h1>登录</h1>'
    };
    const register = {
        template: '<h1>注册</h1>'
    };
    const router = new VueRouter({
        routes: [
            {
                path: '/account', component: account,
                children: [
                    {path: 'login', component: login},
                    {path: 'register', component: register},
                ]
            },

        ],
        linkActiveClass: 'myactive'
    });
    const vm = new Vue({
        el: '#app',
        data: {},
        methods: {},
        router: router

    })
</script>
</body>
</html>